﻿using ClusteringProblem.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ClusteringProblem.Maths.Metrics
{
    /// <summary>
    /// Miara euklidesowa
    /// </summary>
    public class EuclideanDistance : IDistance
    {
        public double ComputeDistance(IVectorType x, IVectorType y)
        {
            double result = 0;

            for (int i = 0; i < x.Vector.Length; ++i)
            {
                result += Math.Pow(x.Vector[i] - y.Vector[i], 2);
            }

            return Math.Sqrt(result);
        }
    }
}
